package com.qh.book.converter;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;

import com.qh.book.dataobj.Book;
import com.qh.book.dto.BookDTO;

public class Book2BookDTO {


	public static BookDTO converter(Book book) {
		BookDTO dto = new BookDTO();
		BeanUtils.copyProperties(book, dto);
		return dto;
		
	}
	
	public static List<BookDTO> converter(List<Book> booklist) {
		List<BookDTO> dtoList = new ArrayList<BookDTO>();
		
		for (Book book : booklist) {
			BookDTO dto = new BookDTO();
			dto = converter(book);
			dtoList.add(dto);
		}
		return dtoList;
		
	}
}
